
#!/usr/bin/python
#coding:utf-8 
class _const:
    """ 常量类,定义了就不可以改变 """
    class ConstError(TypeError): pass
    class ConstCaseError(ConstError): pass

    def __setattr__(self, name, value):
        if name in self.__dict__:
            raise self.ConstError("can't change const %s" % name)
        if not name.isupper():
            raise self.ConstCaseError('const name "%s" is not all uppercase' % name)
        self.__dict__[name] = value

const = _const()
const.CGRAIN = "Hello World"
const.AGE = 23
const.REMAEK = "没有女朋友,以码会友,来个湖南小姐姐教我敲代码!!!"



